export default {
    convertFileToBase64(file, callback, errorCallback) {
        try {
            let reader = new FileReader();
            reader.readAsDataURL(file);
            reader.onload = function (e) {
                if (callback) {
                    let base64Str = e.target.result;
                   return  callback(base64Str);
                }
            };
            return reader.onload
        } catch (error) {
            console.error(error);
            if (errorCallback) {
                errorCallback(error);
            }
        }
    },
    convertBlobToBase64(blob, callback, errorCallback) {
        try {
            let reader = new FileReader();
            reader.readAsDataURL(blob);
            reader.onload = function (e) {
                if (callback) {
                    let base64Str = e.target.result;
                    callback(base64Str);
                }
            };
            return reader.onload
        } catch (error) {
            console.error(error);
            if (errorCallback) {
                errorCallback(error);
            }
        }
    }
}